﻿//-----------------------------------------------------------------------
// <copyright file="CardType.cs" company="Bugger Sisters Inc.">
//     Copyright (c) Bugger Sisters Inc. All rights reserved.
// </copyright>
// <author>Sergey Tyshkovets</author>
//-----------------------------------------------------------------------

using System.Linq;

namespace MagicTheGathering.Core
{
    using System;
    using System.Collections.Generic;

    using CardTypes = Enums.CardTypes;

    public class CardType : FlagSet<CardType, CardTypes>
    {
        protected CardType(CardTypes type) : base(type)
        {
        }

        public CardType()
        {
        }

        public Boolean CanBePermanent()
        {
            var targetCardTypes = new List<CardTypes>
                                      {
                                          CardTypes.Artifact,
                                          CardTypes.Creature,
                                          CardTypes.Enchantment,
                                          CardTypes.Land,
                                      };
            return items.Any(i => targetCardTypes.Contains<CardTypes>(i));
        }

        #region [Static single types]

        public static CardType Artifact
        {
            get
            {
                return new CardType(CardTypes.Artifact);
            }
        }

        public static CardType Creature
        {
            get
            {
                return new CardType(CardTypes.Creature);
            }
        }

        public static CardType Enchantment
        {
            get
            {
                return new CardType(CardTypes.Enchantment);
            }
        }

        public static CardType Instant
        {
            get
            {
                return new CardType(CardTypes.Instant);
            }
        }

        public static CardType Land
        {
            get
            {
                return new CardType(CardTypes.Land);
            }
        }

        public static CardType Sorcery
        {
            get
            {
                return new CardType(CardTypes.Sorcery);
            }
        }

        #endregion
    }
}
